package de.reondo.jos;

public class ClassInfoDependencyEdge {

    private ClassInfo source;
    private ClassInfo target;
    private ClassDependencyType type;
    // not part of equality
    private String occurrence;
    
    public String getOccurrence() {
        return occurrence;
    }

    public ClassDependencyType getType() {
        return type;
    }

    public ClassInfoDependencyEdge(ClassDependencyType dependencyType, ClassInfo source, ClassInfo target, String occurrence) {
        this.type = dependencyType;
        this.source = source;
        this.target = target;
        this.occurrence = occurrence;
    }
    public ClassInfo getSource() {
        return source;
    }

    public ClassInfo getTarget() {
        return target;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((source == null) ? 0 : source.hashCode());
        result = prime * result + ((target == null) ? 0 : target.hashCode());
        result = prime * result + ((type == null) ? 0 : type.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        ClassInfoDependencyEdge other = (ClassInfoDependencyEdge) obj;
        if (source == null) {
            if (other.source != null)
                return false;
        } else if (!source.equals(other.source))
            return false;
        if (target == null) {
            if (other.target != null)
                return false;
        } else if (!target.equals(other.target))
            return false;
        if (type != other.type)
            return false;
        return true;
    }

    
    
}
